import javax.swing.*;
import javax.imageio.*;
import java.awt.*;
import java.awt.image.*;
import java.io.*;

public class S
{
    public static BufferedImage buffer;
    public static Graphics2D offscreen;
    public static FontMetrics fm;
    public static int w;
    public static int h;
    
    public static void main (String[] args) throws Exception
    {
        String[] msgs = new String[]{
            "start",
            "do nothing",
            "do absolutely nothing",
            "level 0",
            "level 1",
            "level 2",
            "level 3",
        };
        
        for (int k=0; k<msgs.length; k++)
        {
            Font font = new Font("Arial", Font.BOLD, 36);
            
            int w = 600;
            int h = 64;
            BufferedImage buffer = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
            Graphics2D offscreen = buffer.createGraphics();
            offscreen.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            offscreen.setFont(font);
            FontMetrics fm = offscreen.getFontMetrics();
            
            String msg = msgs[k];
            String name = msg.replaceAll("\\s+", "_");
            
            Color color;
            String fname;
            
            msg = msgs[k];
            color = Color.WHITE;
            fname = name + ".png";
            {
                int width = fm.stringWidth(msg);
                int height = fm.getHeight();
                
                offscreen.setColor(color);
                offscreen.drawString(msg, (w - width)/2, h/2+height/4);
                System.out.println("writing " + fname);
                ImageIO.write(buffer, "PNG", new File(fname));
            }
            msg = "> " + msgs[k] + " <";
            color = Color.YELLOW;
            fname = name + "-selected.png";
            {
                int width = fm.stringWidth(msg);
                int height = fm.getHeight();
                
                offscreen.setColor(color);
                offscreen.drawString(msg, (w - width)/2, h/2+height/4);
                System.out.println("writing " + fname);
                ImageIO.write(buffer, "PNG", new File(fname));
            }
        }
    }
}
